Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

1.4K
Visualizações
How to customize or apply another class with ".cdk-overlay-pane" for angular material mat-select | mat-dialog

I am using mat-select to display a list of options. So, when you click on the mat-select input filed, it shows a list of options using div with cdk-overlay-pane class. I want to customize cdk-overlay-pane class. Using ::ng-deep I did this like,

  ::ng-deep {
    .cdk-overlay-pane {
      transform: translateX(-40px) translateY(-13px) !important;
    }
  }

& it works also, but it is affecting another cdk-overlay-pane.

Is there any way to give customClass to that div with cdk-overlay-pane ?

<div id="cdk-overlay-1" class="cdk-overlay-pane customClass" style="transform: translateX(-40px) translateY(-51px);"> 

so that only this div will be customized & it will not affect other divs.

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

You should use MAT_SELECT_CONFIG injection token . It has an option overlayPanelClass: string | string[], which represents:

the class or list of classes to be applied to the menu's overlay panel.

Shortly, use the following code at component or at module level:

providers: [
    {
      provide: MAT_SELECT_CONFIG,
      useValue: { overlayPanelClass: 'customClass' }
    }
  ],

Demo: https://stackblitz.com/edit/angular-hxgonn


The overlayPanelClass option is available from Angular Material v11.

MAT_SELECT_CONFIG is docummented here. MatSelectConfig is docummented here:

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda